<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="">
<meta name="robots" content="all,follow">

    <title>Bootstrap Admin Template </title>
    <link rel="shortcut icon" href="${ctx}/static/img/favicon.ico">
    
    <!-- global stylesheets -->
    <link href="https://fonts.googleapis.com/css?family=Roboto+Condensed" rel="stylesheet">
    <link rel="stylesheet" href="${ctx}/static/css/bootstrap.min.css">
    <link rel="stylesheet" href="${ctx}/static/font-awesome-4.7.0/css/font-awesome.min.css">
    <link rel="stylesheet" href="${ctx}/static/css/font-icon-style.css">
    <link rel="stylesheet" href="${ctx}/static/css/style.default.css" id="theme-stylesheet">

    <!-- Core stylesheets -->
    <link rel="stylesheet" href="css/form.css">
    <style>
    	.row{
    		margin-left: 0;
    		margin-right: 0;
    	}
    </style>
</head>

<body>
    
<!--====================================================
                     MAIN NAVBAR
======================================================-->
<jsp:include page="../header.jsp" />
<!--====================================================
                    PAGE CONTENT
======================================================-->
    <div class="page-content d-flex align-items-stretch">
       
        <!--***** SIDE NAVBAR *****-->
        <jsp:include page="../left.jsp" />
		<jsp:include page="../alertMsg.jsp" />

        <div class="content-inner form-cont">
            <div class="row">
                <div class="col-md-12">

                    <!--***** BASIC FORM *****-->
                    <div class="card form" id="form1">
                        <div class="card-header">
                            <h3>书籍类型添加</h3>
                        </div>
                        <br>
                        <form action="${ctx}/typeBook/saveOrUpdate">
                        	<input type="hidden" name="id" value="${typeBook.id }">
                            <div class="card form container">
                            	<div class="row">
		                            <div class="col-md-6">
		                                <div class="form-group row">
		                                    <label for="example-text-input" style="width: 85px;" class=" col-form-label">书籍类型</label>
		                                    <div class="col-9">
		                                    	<select class="form-control" id="typeName" name="typeName">
		                                            <option value="-1">请选择...</option>
		                                            <option <c:if test="${typeBook.typeName == 0 }">selected="selected"</c:if> value="0">科学</option>
		                                            <option <c:if test="${typeBook.typeName == 1 }">selected="selected"</c:if> value="1">文学</option>
		                                            <option <c:if test="${typeBook.typeName == 2 }">selected="selected"</c:if> value="2">历史</option>
		                                        </select>
		                                    </div>
		                                </div>
		                                <div class="form-group row">
		                                    <label for="example-text-input" style="width: 85px;" class=" col-form-label">描述</label>
		                                    <div class="col-9">
		                                        <input class="form-control" type="text" value="${typeBook.describes }" name="describes" id="describes">
		                                    </div>
		                                </div>
		                            </div>
		                        </div>
                            </div>
                            <div style="text-align:center;margin-bottom: 20px;">
                            	<button type="submit" onclick="return checkData()" class="btn btn-general btn-blue mr-2">Submit</button>  
                            	<button type="reset" class="btn btn-general btn-white">Cancel</button>
                            </div>
                        
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!--Global Javascript -->
    <script src="${ctx}/static/js/jquery.min.js"></script>
    <script src="${ctx}/static/js/popper/popper.min.js"></script>
    <script src="${ctx}/static/js/tether.min.js"></script>
    <script src="${ctx}/static/js/bootstrap.min.js"></script>
    <script src="${ctx}/static/js/jquery.cookie.js"></script>
    <script src="${ctx}/static/js/jquery.validate.min.js"></script> 
    <script src="${ctx}/static/js/chart.min.js"></script> 
    <script src="${ctx}/static/js/front.js"></script> 
    
    <!--Core Javascript -->
    <script type="text/javascript">
    function checkData(){
 	   
 	   if($("#name").val() == '' || $("#name").val() == null){
 		   alertMsg("书籍类型名不能为空！", "warning");
 		   return false;
 	   }
 	   
 	   if($("#describes").val() == '' || $("#describes").val() == null){
 		   alertMsg("描述不能为空！", "warning");
 		   return false;
 	   }
 	   
    }
    </script>
</body>

</html>